using AutoMapper;
using PhoneBook.Core.Domain.Contacts;
using PhoneBook.Core.Domain.Phones;
using PhoneBook.Core.Domain.UserGroups;
using PhoneBook.Models.Contacts;
using PhoneBook.Models.Phones;
using PhoneBook.Models.UserGroups;

namespace PhoneBook.Extensions
{
    public static class MappingExtensions
    {
        //contact
        public static ContactListModel ToListModel(this Contact entity)
        {
            return Mapper.Map<Contact, ContactListModel>(entity);
        }


        public static ContactAddOrEditModel ToAddOrEditModel(this Contact entity)
        {
            return Mapper.Map<Contact, ContactAddOrEditModel>(entity);
        }


        public static Contact ToEntity(this ContactAddOrEditModel model)
        {
            return Mapper.Map<ContactAddOrEditModel, Contact>(model);
        }


        //user group
        public static UserGroupAddOrEditModel ToAddOrEditModel(this UserGroup entity)
        {
            return Mapper.Map<UserGroup, UserGroupAddOrEditModel>(entity);
        }

        public static UserGroupListModel ToListModel(this UserGroup entity)
        {
            return Mapper.Map<UserGroup, UserGroupListModel>(entity);
        }


        public static UserGroup ToEntity(this UserGroupAddOrEditModel model)
        {
            
            return Mapper.Map<UserGroupAddOrEditModel, UserGroup>(model);
        }


        //phone
        public static PhoneAddOrEditModel ToAddOrEditModel(this Phone entity)
        {
            return Mapper.Map<Phone, PhoneAddOrEditModel>(entity);
        }

        public static PhoneListModel ToListModel(this Phone entity)
        {
            return Mapper.Map<Phone, PhoneListModel>(entity);
        }

        public static Phone ToEntity(this PhoneAddOrEditModel model)
        {
            return Mapper.Map<PhoneAddOrEditModel, Phone>(model);
        }

       
    }
}